package com.yuhuihui.common.utils;

import org.springframework.util.CollectionUtils;

import java.util.HashSet;
import java.util.Map;
import java.util.Set;

/**
 * map工具类
 *
 * @author yuhh
 * @date 2023-05-25 14:37:05
 */
public final class MapUtil {

    /**
     * 获取map的keys
     *
     * @param map 需要获取keys的map
     * @return {@link Set }<{@link T }> keys
     * @author yuhh
     * @date 2023-05-25 14:37:02
     */
    public static <T> Set<T> getKeys(Map<T, ?> map){
        Set<T> keys = new HashSet<>();
        if (!CollectionUtils.isEmpty(map)){
            keys = map.keySet();
        }
        return keys;
    }
}
